package com.ocom.payconfig.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.card.EntityKitchenPrtScheme;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.common.enums.MasterSlaveEnum;
import com.ocom.common.vo.payconfig.kitchenprinter.GetSchemeOnPrtInfoDto;
import com.ocom.mysql.aspect.DataSourceAspect;
import com.ocom.payconfig.dao.IDaoKitchenPrtScheme;
import com.ocom.payconfig.service.KitchenPrtSchemeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class KitchenPrtSchemeServiceImpl extends ServiceImpl<IDaoKitchenPrtScheme, EntityKitchenPrtScheme> implements KitchenPrtSchemeService {

    @Autowired
    private IDaoKitchenPrtScheme iDaoKitchenPrtScheme;


    @Override
    @DataSourceAspect(type = DataSourceEnum.PART_DB,companyId = "comId",isMaster = MasterSlaveEnum.MASTER)
    public boolean saveScheme(Long comId, EntityKitchenPrtScheme entityKitchenPrtScheme) {
        return this.saveOrUpdate(entityKitchenPrtScheme);
    }

    @Override
    @DataSourceAspect(type = DataSourceEnum.PART_DB,companyId = "comId",isMaster = MasterSlaveEnum.SLAVE)
    public List<GetSchemeOnPrtInfoDto> getSchemeOnPrtInfo(Long comId, Long restId, Integer ifMaster, String strArea) {
        return iDaoKitchenPrtScheme.getSchemeOnPrtInfo(comId, restId, ifMaster, strArea);
    }


    @Override
    @DataSourceAspect(type = DataSourceEnum.PART_DB,companyId = "comId",isMaster = MasterSlaveEnum.SLAVE)
    public List<GetSchemeOnPrtInfoDto> getCountMachList(Long comId,Integer product) {
        return iDaoKitchenPrtScheme.getSchemeOnPrtInfo1(comId, product);
    }
}
